#ifndef KEYTREE_H
#define KEYTREE_H
#include <iostream>

#include <iostream>
#include <algorithm>
#include <stdexcept>
#include <sstream>
#include <deque>
#include "keynode/keynode.h"
#include "keynode/logger.h"
#include "keynode/CoinClasses/Base58Check.h"
#include "keytreeutil.h"

/// 获得主私钥链上的信息
/// return : 子私钥
std::string srOutputChildPrvKey(const std::string &extKey,
                              const std::string &chainStr, bool isTest = false);



/// 获得主私钥的信息
int srOutputKeyInfo(const std::string &ekPrvKey,
                                  std::string& out_ekPubKey,
                                  std::string& out_pubKey,
                                  std::string& out_prvKey,
                                  std::string& out_address,
                                  bool isTest = false);


// 根据种子和索引，获得主私钥
std::string srOutputExtKeysFromSeed(const std::string& seed,
                                    const std::string& chainStr,
                                    bool isTest = false);


















KeyNode traversePreorder(const KeyNode& keyNode,
                         TreeChains treeChains,
                         const std::string& chainName);

// 根据种子和索引，获得主私钥
std::string outputExtKeysFromSeed(const std::string& seed, const std::string& chainStr);

// 根据私钥 获得公钥和地址
std::string outputPubKey(const std::string& seed, const std::string& chainStr);

// 根据私钥 获得公钥和地址
int outputAddr(const std::string& prvKey, std::string& addr);

std::string outputExtKeysFromExtKey(const std::string& extKey,
                                    const std::string& chainStr);

std::string outputChildPrvKey(const std::string &extKey,
                              const std::string &chainStr, bool isTest = false);


#endif // KEYTREE_H
